package org.colcon.web.model;

import java.util.HashMap;
import java.util.Map;

import org.colcon.web.model.framework.IBallot;

public class Ballot extends Item implements IBallot
{
	private static final long serialVersionUID = 8988178703134546530L;
	
	private static final String
	
		// arguments
		USER = "user",
		VOTE = "vote",
		VALUE = "value";
	
	private String value;
	
	public Ballot()
	{
		this(new HashMap<String, String>());
	}
	
	public Ballot(Map<String, String> args)
	{
		this(
				args.get(USER), 
				args.get(VOTE), 
				args.get(VALUE)
		);
	}
	
	public Ballot(String vote, String user, String value)
	{
		// store by id of voter
		super(vote, user);

		this.value = value;
	}
	
	public String getVote()
	{
		return getParentPath();
	}
	
	public String getUser()
	{
		return getId();
	}
	
	public String getValue()
	{
		return value;
	}

	public String getText() 
	{
		return "Ballot from " + getUser();
	}
}
